In [1]:
import numpy as np
import math
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
#Layer 1 - input
print ("Layer 1")
X1 = np.array ([[1,0,1],
[1+0.,0,1],
[1,1,1],
[1,0,0]])
print ("X1 =", X1)
In [3]:
# Layer 2
print ("Layer2")
B2 = np.array ([0,0])
print ("B2 =" , B2)
print ("X1 =", X1)
W12 = np.array ([[0,1],
[0,0],
[1,0]])
#W1 = np.random.randn(4, 3)
W12
print ("W12 =")
print (W12)
Y2 = X1.dot(W12) + B2
print ("Y2 =", Y2)
A2 =1/(1+np.exp(-Y2))
print ("A2 =", A2)
In [4]:
# Layer 3
print ("Layer3")
B3 = np.array ([0,0])
print ("B2 =" , B2)
print ("A2 =", A2)
W23 = np.array ([[1,0],
[0,1]])
#W3 = np.random.randn(2, 3)
print ("W23 =")
print (W23)
Y3 = A2.dot(W23) + B3
print ("Y3 =", Y3)
A3 =1/(1+np.exp(-Y3))
print ("A3 =", A3)
In [ ]:
In [ ]: